﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using dhSystemBLL.basicData;
using dhDataAcess.Model;
using dhDataAcess.orderLinqDAL;
using dhDataAcess.dataAcess;
using dhDataAcess.dataAcess.sysDataSetTableAdapters;
using System.Data.SqlClient;


namespace baseSet.importExport
{
    public partial class FrmImport : Form
    {
        //部门表
        sysDataSet.deptListRow deptRow;
        deptListModel Row = new deptListModel();
        dhSystemBLL.basicData.deptBLL dept = new deptBLL();
        //模块表格
        sysDataSet.itemListRow itemRow;
        itemListModel itemListRow = new itemListModel();
        dhSystemBLL.basicData.itemListBLL itemList = new itemListBLL();
        //厂品表
        orderDataSet.productListRow productRow;
        productListModel productListRow = new productListModel();
        dhSystemBLL.orderData.productListBLL product = new dhSystemBLL.orderData.productListBLL();
        //客户表
        orderDataSet.custListRow custRow;
        custListModel custListRow = new custListModel();
        dhSystemBLL.orderData.custListBLL cust = new dhSystemBLL.orderData.custListBLL();
        //供应商表
        orderDataSet.supplierListRow supplierRow;
        supplierListModel supplierListRow = new supplierListModel();
        dhSystemBLL.orderData.supplierListBLL suppllier = new dhSystemBLL.orderData.supplierListBLL();
        //原材料产品表
        orderDataSet.materialListRow materialRow;
        materialListModel materialListRow = new materialListModel();
        dhSystemBLL.orderData.materialListBLL material = new dhSystemBLL.orderData.materialListBLL();
        //仓位表
        orderDataSet.stockPositionRow PositionRow;
        stockPositionModel stockPositionRow = new stockPositionModel();
        dhSystemBLL.orderData.stockPositionBLL stockPosition = new dhSystemBLL.orderData.stockPositionBLL();
        //地址信息表
        orderDataSet.custAddListRow custAddRow;
        custAddListModel custAddListRow = new custAddListModel();
        dhSystemBLL.orderData.custAddListBLL custAddList = new dhSystemBLL.orderData.custAddListBLL();
        string moduleNum = null;

        public FrmImport(string _moduleNum)
        {
            moduleNum = _moduleNum;
            InitializeComponent();
        }
        //职员表
        sysDataSet.workerListRow  workerRow;
        workerListModel workerListRow = new workerListModel();
        dhSystemBLL.basicData.workerListBLL worker = new workerListBLL();
       //打开导入表格时发生的事件
        private void openFileDialog_FileOk(object sender, CancelEventArgs e)
        {
            try
            { 
                string fileName = openFileDialog.FileName;
                List<string[]> ls = readerCsv.readCsv(fileName);
                itemListBLL item = new itemListBLL();
                sysDataSet.itemListDataTable itemTable = item.getitemListBymoduleNum(moduleNum);
                //部门表
                if (moduleNum == "deptList") 
                {
                    string[] strTitle = ls[0];
                    int strLen = strTitle.Length;
                    sysDataSet.deptListDataTable deptTable = new sysDataSet.deptListDataTable();
                    
                    for (int i = 1; i < ls.Count(); i++)
                    {
                        string[] strArr = ls[i];

                         deptRow = deptTable.NewdeptListRow();
                        foreach (sysDataSet.itemListRow row in itemTable)
                        {
                            for (int j = 0; j < strLen; j++)
                            {
                                if (row.itemDispC == strTitle[j])
                                {
                                    deptRow[row.itemName] = strArr[j];
                                }
                            }

                        }
                        deptTable.AdddeptListRow(deptRow);

                    }
                    dGridImport.DataSource = deptTable;
                    DcolumnSet.colSet(moduleInfo.deptList, dGridImport);
                }
                //模块表格
               else  if (moduleNum == "itemList")
                {
                    string[] strTitle = ls[0];
                    int strLen = strTitle.Length;
                    sysDataSet.itemListDataTable itemListTable = new sysDataSet.itemListDataTable();
                    for (int i = 1; i < ls.Count(); i++)
                    {
                        string[] strArr = ls[i];

                        itemRow = itemListTable.NewitemListRow();
                        foreach (sysDataSet.itemListRow row in itemTable)
                        {
                            for (int j = 0; j < strLen; j++)
                            {
                                if (row.itemDispC == strTitle[j])
                                {
                                    itemRow [row.itemName] = strArr[j];

                                }

                            }

                        }
                        itemListTable.AdditemListRow(itemRow);

                    }
                    dGridImport.DataSource = itemListTable;
                    DcolumnSet.colSet(moduleInfo.itemList, dGridImport);
                }
                //厂品表
              else if (moduleNum == "productList")
                {
                    string[] strTitle = ls[0];
                    int strLen = strTitle.Length;
                    orderDataSet.productListDataTable productTable = new orderDataSet.productListDataTable();
                    for (int i = 1; i < ls.Count(); i++)
                    {
                        string[] strArr = ls[i];

                        productRow = productTable.NewproductListRow();
                        foreach (sysDataSet.itemListRow row in itemTable)
                        {
                            for (int j = 0; j < strLen; j++)
                            {
                                if (row.itemDispC == strTitle[j])
                                {
                                    productRow[row.itemName] = strArr[j];
                                }
                            }

                        }
                        productTable.AddproductListRow (productRow);

                    }
                    dGridImport.DataSource = productTable;
                    DcolumnSet.colSet(moduleInfo.productList , dGridImport);
                }
                //客户表
                else if (moduleNum == "custList")
                {
                    string[] strTitle = ls[0];
                    int strLen = strTitle.Length;
                    orderDataSet.custListDataTable custTable = new orderDataSet.custListDataTable();

                    for (int i = 1; i < ls.Count(); i++)
                    {
                        string[] strArr = ls[i];

                        custRow = custTable.NewcustListRow();
                        foreach (sysDataSet.itemListRow row in itemTable)
                        {
                            for (int j = 0; j < strLen; j++)
                            {
                                if (row.itemDispC == strTitle[j])
                                {
                                    custRow[row.itemName] = strArr[j];
                                }
                            }

                        }
                        custTable .AddcustListRow (custRow);

                    }
                    dGridImport.DataSource = custTable;
                    DcolumnSet.colSet(moduleInfo.custList , dGridImport);
                }
                //供应商表
                else if (moduleNum == "supplierList")
                {
                    string[] strTitle = ls[0];
                    int strLen = strTitle.Length;
                    orderDataSet.supplierListDataTable supplierTable = new orderDataSet.supplierListDataTable();

                    for (int i = 1; i < ls.Count(); i++)
                    {
                        string[] strArr = ls[i];

                        supplierRow = supplierTable.NewsupplierListRow ();
                        foreach (sysDataSet.itemListRow row in itemTable)
                        {
                            for (int j = 0; j < strLen; j++)
                            {
                                if (row.itemDispC == strTitle[j])
                                {
                                    supplierRow[row.itemName] = strArr[j];
                                }
                            }

                        }
                        supplierTable.AddsupplierListRow (supplierRow);

                    }
                    dGridImport.DataSource = supplierTable; 
                    DcolumnSet.colSet(moduleInfo.supplierList,dGridImport );
                }
                //原材料产品表
                else if (moduleNum == "materialList")
                {
                    string[] strTitle = ls[0];
                    int strLen = strTitle.Length;
                    orderDataSet.materialListDataTable materialTable = new orderDataSet.materialListDataTable();

                    for (int i = 1; i < ls.Count(); i++)
                    {
                        string[] strArr = ls[i];

                        materialRow = materialTable.NewmaterialListRow();
                        foreach (sysDataSet.itemListRow row in itemTable)
                        {
                            for (int j = 0; j < strLen; j++)
                            {
                                if (row.itemDispC == strTitle[j])
                                {
                                    materialRow[row.itemName] = strArr[j];
                                }
                            }

                        }
                        materialTable.AddmaterialListRow (materialRow);

                    }
                    dGridImport.DataSource = materialTable;
                    DcolumnSet.colSet(moduleInfo.materialList , dGridImport);
                }
                //职员表
                if (moduleNum == "workerList")
                {
                    string[] strTitle = ls[0];
                    int strLen = strTitle.Length;
                    sysDataSet.workerListDataTable workerTable = new sysDataSet.workerListDataTable();

                    for (int i = 1; i < ls.Count(); i++)
                    {
                        string[] strArr = ls[i];

                        workerRow  = workerTable.NewworkerListRow();
                        foreach (sysDataSet.itemListRow row in itemTable)
                        {
                            for (int j = 0; j < strLen; j++)
                            {
                                if (row.itemDispC == strTitle[j])
                                {
                                    workerRow[row.itemName] = strArr[j];
                                }
                            }

                        }
                        workerTable.AddworkerListRow(workerRow);

                    }
                    dGridImport.DataSource = workerTable;
                    DcolumnSet.colSet(moduleInfo.workerList , dGridImport);
                }
                //仓位表
                else if (moduleNum == "stockPosition")
                {
                    string[] strTitle = ls[0];
                    int strLen = strTitle.Length;
                    orderDataSet.stockPositionDataTable stockPositionTable = new orderDataSet.stockPositionDataTable();
                    for (int i = 1; i < ls.Count(); i++)
                    {
                        string[] strArr = ls[i];

                        PositionRow = stockPositionTable.NewstockPositionRow();
                        foreach (sysDataSet.itemListRow row in itemTable)
                        {
                            for (int j = 0; j < strLen; j++)
                            {
                                if (row.itemDispC == strTitle[j])
                                {
                                    PositionRow[row.itemName] = strArr[j];
                                }
                            }

                        }
                        stockPositionTable.AddstockPositionRow(PositionRow);

                    }
                    dGridImport.DataSource = stockPositionTable;
                    DcolumnSet.colSet(moduleInfo.stockPosition, dGridImport);
                }
                //客户地址表
                else if (moduleNum == "custAddList")
                {
                    string[] strTitle = ls[0];
                    int strLen = strTitle.Length;
                    orderDataSet.custAddListDataTable custAddListTable = new orderDataSet.custAddListDataTable();
                    for (int i = 1; i < ls.Count(); i++)
                    {
                        string[] strArr = ls[i];

                        custAddRow = custAddListTable.NewcustAddListRow();
                        foreach (sysDataSet.itemListRow row in itemTable)
                        {
                            for (int j = 0; j < strLen; j++)
                            {
                                if (row.itemDispC == strTitle[j])
                                {
                                    custAddRow[row.itemName] = strArr[j];
                                }
                            }

                        }
                        custAddListTable.AddcustAddListRow(custAddRow);

                    }
                    dGridImport.DataSource = custAddListTable;
                    DcolumnSet.colSet(moduleInfo.custAddList , dGridImport);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }
        //选择文件按钮
        private void button1_Click(object sender, EventArgs e)
        {
            openFileDialog.ShowDialog();
        }
        //导入数据按钮
        private void button2_Click(object sender, EventArgs e)
        {


            try
            {
                string fileName = openFileDialog.FileName;
                List<string[]> ls = readerCsv.readCsv(fileName);
                itemListBLL item = new itemListBLL();
                sysDataSet.itemListDataTable itemTable = item.getitemListBymoduleNum(moduleNum);

                //部门表
                if (moduleNum == "deptList")
                {
                    string[] strTitle = ls[0];
                    int strLen = strTitle.Length;
                    sysDataSet.deptListDataTable deptTable = new sysDataSet.deptListDataTable();
                    for (int i = 1; i < ls.Count(); i++)
                    {
                        string[] strArr = ls[i];

                        deptRow = deptTable.NewdeptListRow();
                        foreach (sysDataSet.itemListRow row in itemTable)
                        {
                            for (int j = 0; j < strLen; j++)
                            {
                                if (row.itemDispC == strTitle[j])
                                {
                                    deptRow[row.itemName] = strArr[j];

                                }

                            }

                        }
                        Row.deptnum = deptRow.deptNum;
                        Row.deptname = deptRow.deptName;
                        Row.createdate = DateTime.Now;
                        Row.createuser = deptRow.createUser;
                        Row.updatedate = DateTime.Now;
                        Row.updateuser = deptRow.updateUser;
                        Row.mark = deptRow.mark;
                        dept.deptListInsert(Row);
                        // SqlCommand cmd = new SqlCommand();
                        // cmd.Connection = dhDataAcess.baseBLL.dataConn.connOpen();
                        // cmd.CommandType = CommandType.StoredProcedure;
                        //// DataTable t = new DataTable();
                        // deptTable.AdddeptListRow(deptRow );
                        //// t = (DataTable)deptTable;
                        // SqlParameter par = new SqlParameter("@protuctTable", deptTable ) ;                   

                        // par.SqlDbType = SqlDbType.Structured;
                        // par.TypeName = "dbo.dpetList";
                        // cmd.Parameters.Add(par);
                        // cmd.CommandText = "importExport";
                        // cmd.ExecuteNonQuery();


                    }
                    MessageBox.Show("导入成功");

                }
                //模块表格
                else if (moduleNum == "itemList")
                {
                    string[] strTitle = ls[0];
                    int strLen = strTitle.Length;
                    sysDataSet.itemListDataTable itemListTable = new sysDataSet.itemListDataTable();
                    for (int i = 1; i < ls.Count(); i++)
                    {
                        string[] strArr = ls[i];

                        itemRow = itemListTable.NewitemListRow();
                        foreach (sysDataSet.itemListRow row in itemTable)
                        {
                            for (int j = 0; j < strLen; j++)
                            {
                                if (row.itemDispC == strTitle[j])
                                {
                                    itemRow[row.itemName] = strArr[j];

                                }

                            }

                        }
                        itemListRow.moduleNum = itemRow.moduleNum;
                        itemListRow.itemName = itemRow.itemName;
                        itemListRow.itemNum = itemRow.itemNum;
                        itemListRow.itemDispC = itemRow.itemDispC;
                        itemListRow.itemDispE = itemRow.itemDispE;
                        itemListRow.itemDispJ = itemRow.itemDispJ;
                        itemListRow.itemDispIndex = itemRow.itemDispIndex;
                        itemListRow.itemWidth = itemRow.itemWidth;
                        itemListRow.itemDispNo = itemRow.itemDispNo;
                        itemListRow.itemDataType = itemRow.itemDataType;
                        itemListRow.createDate = DateTime.Now;
                        itemListRow.createUser = itemRow.createUser;
                        itemListRow.updateDate = DateTime.Now;
                        itemListRow.updateUser = itemRow.updateUser;
                        itemListRow.mark = itemRow.mark;
                        itemList.itemListInsert(itemListRow);
                    }
                    MessageBox.Show("导入成功");
                }
                //厂品表
                else if (moduleNum == "productList")
                {
                    string[] strTitle = ls[0];
                    int strLen = strTitle.Length;
                    orderDataSet.productListDataTable productTable = new orderDataSet.productListDataTable();
                    for (int i = 1; i < ls.Count(); i++)
                    {
                        string[] strArr = ls[i];

                        productRow = productTable.NewproductListRow();
                        foreach (sysDataSet.itemListRow row in itemTable)
                        {
                            for (int j = 0; j < strLen; j++)
                            {
                                if (row.itemDispC == strTitle[j])
                                {
                                    productRow[row.itemName] = strArr[j];

                                }

                            }

                        }
                        productListRow.grwight = productRow.grwight;
                        productListRow.pname = productRow.pname;
                        productListRow.pnameMark = productRow.pnameMark;
                        productListRow.ptype = productRow.ptype;
                        productListRow.pmode = productRow.pmode;
                        productListRow.pattr = productRow.pattr;
                        productListRow.createDate = DateTime.Now;
                        productListRow.createUser = productRow.createUser;
                        productListRow.updateDate = DateTime.Now;
                        productListRow.updateUser = productRow.updateUser;
                        productListRow.mark = productRow.mark;
                        //product.productListInsert(productListRow);
                        productTable.AddproductListRow(productRow);
                    }

                    product.productListimoportInsert(productTable);
                   
                    MessageBox.Show("导入成功");

                }
                //客户表
                else if (moduleNum == "custList")
                {
                    string[] strTitle = ls[0];
                    int strLen = strTitle.Length;
                    orderDataSet.custListDataTable custTable = new orderDataSet.custListDataTable();

                    for (int i = 1; i < ls.Count(); i++)
                    {
                        string[] strArr = ls[i];

                        custRow = custTable.NewcustListRow();
                        foreach (sysDataSet.itemListRow row in itemTable)
                        {
                            for (int j = 0; j < strLen; j++)
                            {
                                if (row.itemDispC == strTitle[j])
                                {
                                    custRow[row.itemName] = strArr[j];
                                }

                            }

                        }
                        custListRow.custNum = custRow.custNum;
                        custListRow.custName = custRow.custName;
                        custListRow.custAdd = custRow.custAdd;
                        custListRow.phone = custRow.phone;
                        custListRow.linkMan = custRow.linkMan;
                        custListRow.postCode = custRow.postCode;
                        custListRow.qq = custRow.qq;
                        custListRow.mobilePhone = custRow.mobilePhone;
                        custListRow.fax = custRow.fax;
                        custListRow.workerNum = custRow.workerNum;
                        custListRow.payType = custRow.payType;
                        custListRow.taxMark = custRow.taxMark;
                        custListRow.cType = custRow.cType;
                        custListRow.ctypeMark = custRow.ctypeMark;
                        custListRow.ctypeparent = custRow.ctypeparent;
                        custListRow.createDate = DateTime.Now;
                        custListRow.createUser = custRow.createUser;
                        custListRow.updateDate = DateTime.Now;
                        custListRow.updateUser = custRow.updateUser;
                        custListRow.mark = custRow.mark;
                        cust.custListInsert(custListRow);
                    }
                    MessageBox.Show("导入成功");

                }
                //供应商表
                else if (moduleNum == "supplierList")
                {
                    string[] strTitle = ls[0];
                    int strLen = strTitle.Length;
                    orderDataSet.supplierListDataTable supplierTable = new orderDataSet.supplierListDataTable();

                    for (int i = 1; i < ls.Count(); i++)
                    {
                        string[] strArr = ls[i];

                        supplierRow = supplierTable.NewsupplierListRow();
                        foreach (sysDataSet.itemListRow row in itemTable)
                        {
                            for (int j = 0; j < strLen; j++)
                            {
                                if (row.itemDispC == strTitle[j])
                                {
                                    supplierRow[row.itemName] = strArr[j];
                                }

                            }

                        }
                        supplierListRow.sNum = supplierRow.sNum;
                        supplierListRow.sName = supplierRow.sName;
                        supplierListRow.linkman = supplierRow.linkman;
                        supplierListRow.phone = supplierRow.phone;
                        supplierListRow.mail = supplierRow.mail;
                        supplierListRow.qq = supplierRow.qq;
                        supplierListRow.fax = supplierRow.fax;
                        supplierListRow.addres = supplierRow.addres;
                        supplierListRow.payType = supplierRow.payType;
                        supplierListRow.billType = supplierRow.billType;
                        supplierListRow.sType = supplierRow.sType;
                        supplierListRow.createDate = DateTime.Now;
                        supplierListRow.createUser = supplierRow.createUser;
                        supplierListRow.updateDate = DateTime.Now;
                        supplierListRow.updateUser = supplierRow.updateUser;
                        supplierListRow.mark = supplierRow.mark;
                        suppllier.supplierListInsert(supplierListRow);
                    }
                    MessageBox.Show("导入成功");

                }
                //原材料产品表
                else if (moduleNum == "materialList")
                {
                    string[] strTitle = ls[0];
                    int strLen = strTitle.Length;
                    orderDataSet.materialListDataTable materialTable = new orderDataSet.materialListDataTable();

                    for (int i = 1; i < ls.Count(); i++)
                    {
                        string[] strArr = ls[i];

                        materialRow = materialTable.NewmaterialListRow();
                        foreach (sysDataSet.itemListRow row in itemTable)
                        {
                            for (int j = 0; j < strLen; j++)
                            {
                                if (row.itemDispC == strTitle[j])
                                {
                                    materialRow[row.itemName] = strArr[j];
                                }

                            }

                        }
                        materialListRow.matNum = materialRow.matNum;
                        materialListRow.mtype = materialRow.mtype;
                        materialListRow.matName = materialRow.matName;
                        materialListRow.matSpec = materialRow.matSpec;
                        materialListRow.matpord = materialRow.matpord;
                        materialListRow.unit = materialRow.unit;
                        materialListRow.Fzunit = materialRow.Fzunit;
                        materialListRow.matLot = materialRow.matLot;
                        materialListRow.stockName = materialRow.stockName;
                        materialListRow.posName = materialRow.posName;
                        materialListRow.createDate = DateTime.Now;
                        materialListRow.createUser = materialRow.createUser;
                        materialListRow.updateDate = DateTime.Now;
                        materialListRow.updateUser = materialRow.updateUser;
                        materialListRow.mark = materialRow.mark;
                        materialListRow.stockQty =Convert .ToDecimal( materialRow.stockListRow);
                        materialListRow.supplier = materialRow.supplier;
                        materialTable.AddmaterialListRow(materialRow);
                        
                    }
                    
                    material.materialListimoportInsert(materialTable);
                    MessageBox.Show("导入成功");

                }
                //职员表
                if (moduleNum == "workerList")
                {
                    string[] strTitle = ls[0];
                    int strLen = strTitle.Length;
                    sysDataSet.workerListDataTable workerTable = new sysDataSet.workerListDataTable();
                    for (int i = 1; i < ls.Count(); i++)
                    {
                        string[] strArr = ls[i];

                        workerRow = workerTable.NewworkerListRow();
                        foreach (sysDataSet.itemListRow row in itemTable)
                        {
                            for (int j = 0; j < strLen; j++)
                            {
                                if (row.itemDispC == strTitle[j])
                                {
                                    workerRow[row.itemName] = strArr[j];

                                }

                            }
                        }
                        workerListRow.workerNum = workerRow.workerNum;
                        workerListRow.name = workerRow.name;
                        workerListRow.sex = workerRow.sex;
                        workerListRow.cardnum = workerRow.cardnum;
                        workerListRow.birthday = workerRow.birthday;
                        workerListRow.title = workerRow.title;
                        workerListRow.detpNum = workerRow.detpNum;
                        workerListRow.createDate = workerRow.createDate;
                        workerListRow.createUser = "";
                        workerListRow.updateUser = workerRow.updateUser;
                        workerListRow.updateDate = workerRow.updateDate;
                        workerListRow.mark = workerRow.mark;
                        worker.workerListInsert(workerListRow);
                    }
                    MessageBox.Show("导入成功");

                }
                //仓位表
                else if (moduleNum == "stockPosition")
                {
                    string[] strTitle = ls[0];
                    int strLen = strTitle.Length;
                    orderDataSet.stockPositionDataTable stockPositionTable = new orderDataSet.stockPositionDataTable();

                    for (int i = 1; i < ls.Count(); i++)
                    {
                        string[] strArr = ls[i];

                        PositionRow = stockPositionTable.NewstockPositionRow();
                        foreach (sysDataSet.itemListRow row in itemTable)
                        {
                            for (int j = 0; j < strLen; j++)
                            {
                                if (row.itemDispC == strTitle[j])
                                {
                                    PositionRow[row.itemName] = strArr[j];
                                }

                            }

                        }
                        stockPositionRow.posName = PositionRow.posName;
                        stockPositionRow.stockName = PositionRow.stockName;
                        stockPositionRow.posMark = PositionRow.posMark;
                        stockPositionRow.createUser = PositionRow.createUser;
                        stockPositionRow.createDate = DateTime.Now;
                        stockPositionRow.updateDate = DateTime.Now;
                        stockPositionRow.updateUser = "";
                        stockPositionRow.mark = PositionRow.mark;
                       // stockPosition.stockPositionInsert(stockPositionRow);
                        stockPositionTable.AddstockPositionRow(PositionRow);
                    }
                    stockPosition.stockPositionTableInsert(stockPositionTable);
                    MessageBox.Show("导入成功");
                }
                //客户地址表
                else if (moduleNum == "custAddList")
                {
                    string[] strTitle = ls[0];
                    int strLen = strTitle.Length;
                    orderDataSet.custAddListDataTable custAddListTable = new orderDataSet.custAddListDataTable();

                    for (int i = 1; i < ls.Count(); i++)
                    {
                        string[] strArr = ls[i];

                        custAddRow = custAddListTable.NewcustAddListRow();
                        foreach (sysDataSet.itemListRow row in itemTable)
                        {
                            for (int j = 0; j < strLen; j++)
                            {
                                if (row.itemDispC == strTitle[j])
                                {
                                    custAddRow[row.itemName] = strArr[j];
                                }

                            }

                        }
                        custAddListRow.custNum = custAddRow.custNum;
                        custAddListRow.addres = custAddRow.addres;
                        custAddListRow.phone = custAddRow.phone;
                        custAddListRow.linkMan = custAddRow.linkMan;
                        custAddListRow.createUser = custAddRow.createUser;
                        custAddListRow.createDate = DateTime.Now;
                        custAddListRow.updateDate = DateTime.Now;
                        custAddListRow.updateUser = "";
                        custAddListRow.mark = custAddRow.mark;
                        custAddList .custAddListInsert (custAddListRow );
                    }
                    MessageBox.Show("导入成功");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }    
        }

        private void FrmImport_Load(object sender, EventArgs e)
        {

        }
    }
}
